<?php 
    include("header.php");
?>

<head>
    <title>Liga - Nieuws</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="assets/css/default.css" rel="stylesheet" type="text/css">

    
    <style type="text/css">

        @import "/assets/js/dojo-release-1.1.0/dijit/themes/tundra/tundra.css";

    </style>
    
    <!--
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" type="text/javascript"></script>
    -->
    <!--<script type="text/javascript" src="/assets/js/dojo-release-1.1.0/dojo/dojo.js"
      djConfig="parseOnLoad: true"></script>-->
    
    <script type="text/javascript">
        dojo.require("dijit.Dialog");
        dojo.require("dijit.form.TextBox");
        dojo.require("dijit.form.Button");
    </script>

</head>
    
<?php
    setTabIndex(1);
    createBody("default");

    $newsId = $_GET['newsId'];

    mysql_connect(DB_SERVER, DB_USER, DB_PWD);

    mysql_select_db(DB_CATALOG);

    $result = mysql_query("SELECT ni.news_id, ni.title, ni.introImage, DATE_FORMAT(ni.date,'%e/%m/%Y %k:%i:%s') as date, ".

                "ni.intro, ni.message, u.username FROM news_item AS ni JOIN news_history AS nh ".

                "ON ni.news_id = nh.news_id JOIN user AS u ON nh.user_id = u.user_id ".

                "WHERE ni.news_id = ".$newsId." ORDER BY DATE DESC");

    $row = mysql_fetch_assoc($result);



    $newsItem = new NewsItem;

    $newsItem->news_id = $row['news_id'];

    $newsItem->title = $row['title'];

    $newsItem->date = $row['date'];

    $newsItem->intro = $row['intro'];

    $newsItem->introImage = $row['introImage'];

    $newsItem->message = $row['message'];

    $newsItem->author = $row['username'];

    

    if ( isValidURL($newsItem->introImage) ) {

        $newsItem->intro = "<table><tr valign=top><td><img src=".$newsItem->introImage." height=60 /></td><td>".$row['intro']."</td></tr></table>";

    }

?>

<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">

    <tr>
        <td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#006633">
            <table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">
                <tr><td>&nbsp;</td></tr>
            </table>
        </td>
        <td id="header" valign="top" width="100%">
            <table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#006633" width="70%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#006633" align="right">&nbsp;
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?>   
                </tr>
                <tr><td colspan="4" nowrap bgcolor="#BCDD10" height="4"><img src="/assets/images/spacer.gif" alt="" height="1" width="1"></td></tr>
                <tr>
                    <td>&nbsp;</td>
                    <td width="75%" valign="top">
                        <table cellspacing="2" cellpadding="5" class="newsbox">

                            <tr >

                                <td valign="top">

                                    <span class="blackHeaderLarge"><?=$newsItem->title?></span>
                                    
                                    <br/><br/>
                                    
                                    <span class="newsDate">Gepost door: <em><?=$newsItem->author?></em> op <?=$newsItem->date?></span>

                                    <br/><?=utf8_encode($newsItem->intro)?>

                                    <br/><br/><?=utf8_encode($newsItem->message)?>

                                </td>

                            </tr>

                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<?php include("footer.php") ?>

